package com.progroup.tabAndroid4;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

public class CustomFragmentAdapter extends FragmentStatePagerAdapter {
	 protected static final String[] CONTENT = new String[] { "USD", "EUR", "RUB" };

	    private int mCount = CONTENT.length;

	    public CustomFragmentAdapter(FragmentManager fragmentManager) {
	        super(fragmentManager);
	    }

		@Override
	    public Fragment getItem(int position) {
	        return CustomFragment.newInstance(CustomFragmentAdapter.CONTENT[position % CustomFragmentAdapter.CONTENT.length]);
	    }

	    @Override
	    public int getCount() {
	    	return CustomFragmentAdapter.CONTENT.length;
	    }

	    public void setCount(int count) {
	        if (count > 0 && count <= 10) {
	            mCount = count;
	            notifyDataSetChanged();
	        }
	     
	    }
	    
	   // @Override
	   // public int getItemPosition(Object object){
	     //   return POSITION_NONE;
	    //}
	    
	    @Override
	    public CharSequence getPageTitle(int position) {
	        return CustomFragmentAdapter.CONTENT[position % CustomFragmentAdapter.CONTENT.length].toUpperCase();
	    }
	    
	   
	    
	    
	}